package org.jweb.demo.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.GenericGenerator;

@Entity
@Table(name = "jweb_demo_goods_pic", schema = "")
@DynamicUpdate(true)
@DynamicInsert(true)
@SuppressWarnings("serial")
public class DemoGoodsPicEntity {

	private String id;
	private String descript;
	private String url;
	private DemoGoodsEntity goodsEntity;
	@Id
	@GeneratedValue(generator = "paymentableGenerator")
	@GenericGenerator(name = "paymentableGenerator", strategy = "uuid")
	@Column(name ="id",nullable=false,length=32)
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	
	@Column(name ="descript",nullable=true,length=32)
	public String getDescript() {
		return descript;
	}
	public void setDescript(String descript) {
		this.descript = descript;
	}
	
	@Column(name ="url",nullable=true,length=32)
	public String getUrl() {
		return url;
	}
	public void setUrl(String url) {
		this.url = url;
	}
	
	@ManyToOne(fetch = FetchType.LAZY) //　　ManyToOne关联到GoodsEntity
    @JoinColumn(name="goods_id")
	public DemoGoodsEntity getGoodsEntity() {
		return goodsEntity;
	}
	public void setGoodsEntity(DemoGoodsEntity goodsEntity) {
		this.goodsEntity = goodsEntity;
	}
	
}
